package utils;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import play.Logger;
import play.Play;

public final class SettingsReader {

	private static Properties properties;

	static {
		if (properties == null) {
			properties = new Properties();
			try {
				properties.load(new FileInputStream(Play
						.getFile("conf/settings.conf")));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
				Logger.error(e, "FileNotFoundException");
			} catch (IOException e) {
				e.printStackTrace();
				Logger.error(e, "IOException");
			}
		}
	}

	private SettingsReader() {

	}

	public static String getProperty(String key) {
		return properties.getProperty(key);
	}

	public static String getProperty(String key, String defaultValue) {
		return properties.getProperty(key, defaultValue);
	}
}
